//
//  SwiftyFloatingWidget+Extension.swift
//  FloatingWindowExample
//
//  Created by Jason on 2021/8/12.
//

import Foundation
import UIKit

public extension CGAffineTransform{
    
    static func transform(from:CGRect,to:CGRect) -> CGAffineTransform {
        
        let scales = CGSize(width: to.width/from.width, height: to.height/from.height)
        
        let offset = CGPoint(x: to.midX - from.midX, y: to.midY - from.midY)
        
        return CGAffineTransform(a: scales.width, b: 0, c: 0, d: scales.height, tx: offset.x, ty: offset.y)
        
    }
    
}

